﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pages_ProducBill : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] != null)
        {
            if (Request.Cookies["Tuyen"] != null)
            {
                int sl = Convert.ToInt32(Request.Cookies["Tuyen"]["SoLuong"]);
                double dg = Convert.ToDouble(Request.Cookies["Tuyen"]["GiaVe"]);
                double tt = sl * dg;
                lbTenKhachHang.Text = Session["UserName"].ToString();
                lbTenTuyen.Text = Request.Cookies["Tuyen"]["TenTuyen"];
                lbBienSoXe.Text = Request.Cookies["Tuyen"]["BienSo"];
                lbGioKhoiHanh.Text = Request.Cookies["Tuyen"]["GioKhoiHanh"];
                lbSoLuong.Text = Request.Cookies["Tuyen"]["SoLuong"];
                lbGia.Text = Request.Cookies["Tuyen"]["GiaVe"] + ".000 VNĐ";
                lbThanhTien.Text = tt.ToString() +".000 VNĐ";
                Session["Tuyen"] = null;
            }
            else
            {
                btOkProductBill.Visible = false;
                btProductBill2.Visible = true;
                lbStatusProductBill.Text = "Erorr order.";
                munvwProductBill.ActiveViewIndex = 1;
            }           
            munvwProductBill.ActiveViewIndex = 0;
        }
        else
        {
            btOkProductBill.Visible = true;
            btProductBill2.Visible = false;
            lbStatusProductBill.Text = "You are not sign in. Please login!";
            munvwProductBill.ActiveViewIndex = 1;
        }
    }
    protected void btOkProductBill_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/Default.aspx");
    }
    protected void btProductBill2_Click(object sender, EventArgs e)
    {        
        Response.Redirect("~/ProductDetail.aspx");
    }
}